package com.zy.cat.entity.ec;

import java.util.List;

import com.zy.cat.entity.mall.resp.TkDetailPicsResp;
import com.zy.cat.entity.wy.TKConvertResp;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.RequiredArgsConstructor;

@lombok.Data
@RequiredArgsConstructor
@ApiModel("高佣转链返回实体类")
public class ECConvertResp {

	@ApiModelProperty(value = "错误码(200.正常，其他错误)", example = "1000")
	private int code;

	@ApiModelProperty(value = "错误信息", example = "success")
	private String msg;

	@ApiModelProperty(value = "优惠券详细信息", example = "1")
	private Data data;

	public ECConvertResp(int code, String msg) {
		super();
		this.code = code;
		this.msg = msg;
	}

	@lombok.Data
	@RequiredArgsConstructor
	@ApiModel("高佣转链详情")
	public static class Data {
		@ApiModelProperty(value = "类目ID", example = "26")
		private String category_id;
		@ApiModelProperty(value = "优惠券领券链接", example = "https://uland")
		private String coupon_click_url;
		@ApiModelProperty(value = "优惠券结束时间", example = "2019-06-23")
		private String coupon_end_time;
		@ApiModelProperty(value = "优惠券信息接", example = "满4元减1元")
		private String coupon_info;
		@ApiModelProperty(value = "优惠券剩余数量", example = "5700")
		private String coupon_remain_count;
		@ApiModelProperty(value = "优惠券开始时间", example = "2019-06-13")
		private String coupon_start_time;
		@ApiModelProperty(value = "优惠券总数量", example = "15000")
		private String coupon_total_count;
		@ApiModelProperty(value = "优惠券类型（1 公开券，2 私有券，3 妈妈券）", example = "")
		private String coupon_type;
		@ApiModelProperty(value = "商品ID", example = "595613585150")
		private String item_id;
		@ApiModelProperty(value = "商品淘客链接（同样为高佣，has_coupon为false时，建议使用此链接）", example = "https://s.click.taobao.com/t?e=m%3D2%26s%3DqDc8uzuCShZw4vFB6t2Z2ueEDrYVVa64yK8Cckff7TXLWlSKdGSYDugDXKFKanSExq3IhSJN6GRf17Z%2F4SahlGANnT5MNc0edTDpiSxRfLIQMzkaSkCJ%2FFqjbzrLJqaqNg%2F5MFp5%2FDUyor16Iwv5KaLWMw3EOEsyJN2owMjhufyvKwXUyuo2IidKY1iiyZYOzsAzH1xYDH6uJ7uyi24C5%2FlLmbZYFXNgB1off8h1yACaPVZTLIRS5qJn5AyUbPoV&union_lens=lensId:TAPI@1609835364@0b5952e1_2b74_176d1aa3efe_721b@01")
		private String item_url;
		@ApiModelProperty(value = "高佣金比例（计划中的最高佣金，如果阿里妈妈帐户为初级，则会走通用佣金）", example = "1.60")
		private String max_commission_rate;
		@ApiModelProperty(value = "", example = "0")
		private String reward_info;
		@ApiModelProperty(value = "商品信息", example = "")
		private ItemInfo item_info;
		@ApiModelProperty(value = "是否有优惠券（true，有；false，没有）", example = "true")
		private boolean has_coupon;
		@ApiModelProperty(value = "	短链接（商品有优惠券时，短链接打开为二合一链接页面，无优惠券时，口令打开为商品页面（注：均为高佣金淘客链接，购买之后均有佣金））", example = "")
		private String short_url;
		@ApiModelProperty(value = "淘口令（商品有优惠券时，口令打开为二合一链接页面，无优惠券时，口令打开为商品页面（注：均为高佣金淘客链接，购买之后均有佣金））", example = "￥FxYEcstAwgz￥")
		private String tpwd;
		@ApiModelProperty(value = "淘口令", example = "2￥FxYEcstAwgz￥/")
		private String tpwd_simple;
		@ApiModelProperty(value = "淘口令", example = "7.0￥FxYEcstAwgz￥打kaἲtaӦ宝或點̸击̸url链 https://m.tb.cn/h.4hBj3WF 至浏览er【除胶剂去胶清洁剂汽车家用粘胶去除神器清洗万能不干胶柏油沥青用】")
		private String tpwd_str;
		@ApiModelProperty(value = "优惠券面额（没有优惠券则不显示此字段）", example = "1")
		private String youhuiquan;
		@ApiModelProperty(value = "优惠券使用条件（优惠券使用限制条件，即满xx元使用）", example = "4")
		private String quanlimit;

		@lombok.Data
		@RequiredArgsConstructor
		@ApiModel("高佣转链商品详情")
		public static class ItemInfo {
			@ApiModelProperty(value = "叶子类目名称", example = "")
			private String cat_leaf_name;
			@ApiModelProperty(value = "一级类目名称", example = "")
			private String cat_name;
			@ApiModelProperty(value = "是否包邮", example = "")
			private boolean free_shipment;
			@ApiModelProperty(value = "	商品链接", example = "")
			private String item_url;
			@ApiModelProperty(value = "", example = "")
			private String ju_online_end_time;
			@ApiModelProperty(value = "", example = "")
			private String ju_online_start_time;
			@ApiModelProperty(value = "", example = "")
			private String ju_pre_show_end_time;
			@ApiModelProperty(value = "", example = "")
			private String ju_pre_show_start_time;
			@ApiModelProperty(value = "商品库类型（支持多库类型输出，以“，”区分，1:营销商品主推库）", example = "")
			private String material_lib_type;
			@ApiModelProperty(value = "店铺名称", example = "")
			private String nick;
			@ApiModelProperty(value = "商品id", example = "595613585150")
			private String num_iid;
			@ApiModelProperty(value = "商品主图", example = "")
			private String pict_url;
			@ApiModelProperty(value = "定金（元） 预售商品", example = "")
			private String presale_deposit;
			@ApiModelProperty(value = "付定金结束时间（毫秒） 预售商品", example = "")
			private String presale_end_time;
			@ApiModelProperty(value = "付定金开始时间（毫秒） 预售商品", example = "")
			private String presale_start_time;
			@ApiModelProperty(value = "付尾款结束时间（毫秒） 预售商品", example = "")
			private String presale_tail_end_time;
			@ApiModelProperty(value = "付尾款开始时间（毫秒） 预售商品", example = "")
			private String presale_tail_start_time;
			@ApiModelProperty(value = "商品所在地", example = "浙江 金华")
			private String provcity;
			@ApiModelProperty(value = "商品一口价格", example = "20")
			private String reserve_price;
			@ApiModelProperty(value = "卖家id", example = "")
			private String seller_id;
			@ApiModelProperty(value = "商品小图列表", example = "")
			private List<String> small_images;
			@ApiModelProperty(value = "", example = "")
			private String superior_brand;
			@ApiModelProperty(value = "商品标题", example = "除胶剂去胶清洁剂汽车家用粘胶去除神器清洗万能不干胶柏油沥青用")
			private String title;
			@ApiModelProperty(value = "", example = "")
			private String tmall_play_activity_end_time;
			@ApiModelProperty(value = "", example = "")
			private String tmall_play_activity_start_time;
			@ApiModelProperty(value = "卖家类型（）", example = "0表示淘宝店铺，1表示天猫店铺")
			private String user_type;
			@ApiModelProperty(value = "30天销量", example = "45920")
			private String volume;
			@ApiModelProperty(value = "商品折扣价格", example = "9.5")
			private String zk_final_price;
		}
	}

	public TKConvertResp parseTKConvertResp() {
		TKConvertResp tkConvertResp = new TKConvertResp();
		tkConvertResp.setResult(this.data.has_coupon ? 1 : 2);
		tkConvertResp.setError(this.code == 200 ? 0 : -2);
		tkConvertResp.setMsg(this.msg);
		TKConvertResp.Data data = new TKConvertResp.Data();
		data.setCat_leaf_name(this.data.item_info.cat_leaf_name);
		data.setCat_name(this.data.item_info.cat_name);
		data.setCategory_id(this.data.category_id);
		data.setCommission_rate(this.data.max_commission_rate);
		data.setCoupon_click_url(this.data.coupon_click_url);
		data.setCoupon_end_time(this.data.coupon_end_time);
		data.setCoupon_info(this.data.coupon_info);
		data.setCoupon_remain_count(this.data.coupon_remain_count);
		data.setCoupon_short_url(this.data.short_url);
		data.setCoupon_start_time(this.data.coupon_start_time);
		data.setCoupon_total_count(this.data.coupon_total_count);
		data.setCoupon_type(this.data.coupon_type);
		data.setItem_url(this.data.item_info.item_url);
		data.setNick(this.data.item_info.nick);
		data.setNum_iid(this.data.item_info.num_iid);
		data.setPict_url(this.data.item_info.pict_url);
		data.setReserve_price(this.data.item_info.reserve_price);
		data.setSclick_url(this.data.item_url);
		data.setSeller_id(this.data.item_info.seller_id);
		data.setTbk_pwd(this.data.tpwd);
		data.setTitle(this.data.item_info.title);
		data.setUser_type(this.data.item_info.user_type);
		data.setVolume(this.data.item_info.volume);
		data.setZk_final_price(this.data.item_info.zk_final_price);
		tkConvertResp.setData(data);
		return tkConvertResp;
	}

}
